package cn.doit.scala.day01.block

import java.util.Random

/**
 * @DATE 2021/12/24/10:21
 * @Author MDK
 * @Version 2021.2.2
 * */
object C01_If01 {
  def main(args: Array[String]): Unit = {
    val array: Array[String] = Array[String]("皮鞭", "蜡烛", "手铐", "丝袜")
    val random = new Random()
    val index: Int = random.nextInt(array.length)
    val elem = array(index)

    println(s"随机获取的角标值是$index  随机获取的元素是$elem")
    if("皮鞭".equals(elem)){
      println("放牛娃")
    }else if("蜡烛".equals(elem)){
      println("加班学习")
    }else if("手铐".equals(elem)){
      println("警察")
    }else{
      println("不知道干啥")
    }
  }
}
